package com.zxy.ziems.server.monitor.pojo.hik;

import com.zxy.ziems.server.monitor.pojo.constants.MonitorConstant;
import com.zxy.ziems.server.monitor.pojo.entity.MonitorDeviceEntity;
import lombok.Data;

import java.util.Objects;
import java.util.regex.Pattern;

/**
 * 海康监控
 * @author chdzq
 * @create 2023/5/25
 */
@Data
public class HikMonitorDevice {

    /**
     *监控点唯一标识
     */
    private String cameraIndexCode;

    /**
     * 监控名称
     */
    private String cameraName;


    /**
     * 监控点类型
     */
    private Integer cameraType;

    /**
     * 监控点类型说明
     */
    private String cameraTypeName;

    /**
     * 通道编号
     */
    private String channelNo;

    /**
     * 通道类型
     */
    private String channelType;

    /**
     * 通道子类型说明
     */
    private String channelTypeName;

    /**
     * 云镜类型（1-全方位云台（带转动和变焦），2-只有变焦,不带转动，3-只有转动，不带变焦，4-无云台，无变焦）
     */
    private String ptz;

    //0-不在线，1-在线
    private Integer status;

    static Pattern pattern = Pattern.compile("厂区.*围栏.*防区.*");

    public MonitorDeviceEntity makeBy() {
        String deviceType = MonitorConstant.DEVICE_TYPE;
        MonitorDeviceEntity entity = new MonitorDeviceEntity();
        entity.setDeviceType(deviceType);
        entity.setCameraType(cameraType);
        entity.setDeviceName(cameraName);
        entity.setDeviceUid(cameraIndexCode);
        entity.setChannelNo(channelNo);
        entity.setChannelType(channelType);
        entity.setChannelTypeName(channelTypeName);
        entity.setCameraTypeName(cameraTypeName);
        entity.setPtz(ptz);
        entity.setStatus(Objects.equals(Integer.valueOf(1), status) ? 1: 0);
        return entity;
    }
}
